package com.at713.activiti.web;

import com.at713.activiti.engine.ProcessAdmin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/11/13 23:31
 */
@RestController
@RequestMapping("/flow")
public class FlowMonitorController {
    @Resource
    private ProcessAdmin processAdmin;
    @GetMapping(value = {"/traceProcess/{processInstanceId}"})
    public void traceprocess(@PathVariable String processInstanceId, HttpServletResponse response) throws IOException {
        processAdmin.generateFlowChart(processInstanceId, response.getOutputStream());
    }
}
